package com.teacher.pojo.enums.items;

import java.math.BigDecimal;

public enum CulturalActivitiesRewardType {
    /**
     * 10->国家一等 20->国家二等 30->国家三等
     * 40->省级一等 50->省级二等 60->省级三等
     * 70->市、校级一等 80->市、校级二等
     * 90->市、校级三等 100->院级一等
     * 110->院级二等 120->院级三等
     */
    A(10, new BigDecimal("30"), "国家一等"),
    B(20, new BigDecimal("26"), "国家二等"),
    C(30, new BigDecimal("24"), "国家三等"),
    D(40, new BigDecimal("24"), "省级一等"),
    E(50, new BigDecimal("18"), "省级二等"),
    F(60, new BigDecimal("16"), "省级三等"),
    G(70, new BigDecimal("10"), "市、校级一等"),
    H(80, new BigDecimal("5"), "市、校级二等"),
    I(90, new BigDecimal("4"), "市、校级三等"),
    J(100, new BigDecimal("5"), "院级一等"),
    K(110, new BigDecimal("3"), "院级二等"),
    L(120, new BigDecimal("2"), "院级三等");
    private Integer code;
    private BigDecimal grades;
    private String name;

    CulturalActivitiesRewardType(Integer code, BigDecimal grades, String name) {
        this.grades = grades;
        this.code = code;
        this.name = name;
    }

    /**
     * 通过code拿到名称
     *
     * @param type
     * @return
     */
    public static String getNameByCode(Integer type) {
        for (CulturalActivitiesRewardType eType : CulturalActivitiesRewardType.values()) {
            if (eType.code.equals(type)) {
                return eType.name;
            }
        }
        return "0";
    }

    /**
     * 通过code拿到分数
     *
     * @param type
     * @return
     */
    public static BigDecimal getGradesByCode(Integer type) {
        for (CulturalActivitiesRewardType eType : CulturalActivitiesRewardType.values()) {
            if (eType.code.equals(type)) {
                return eType.grades;
            }
        }
        return new BigDecimal(0);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public BigDecimal getGrades() {
        return grades;
    }

    public void setGrades(BigDecimal grades) {
        this.grades = grades;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
